# coding = utf-8
# rule vars
charset = "utf-8"  # e.g.: utf-8, gbk etc.
name = "🍅爱豆看书"
url = "https://wap.a6ksw.com/"  # index url
search = {
    "url": "https://wap.a6ksw.com/SearchBook.php",
    "method": "get",
    "input": "keyword",
    "data": {},
    "headers":{}
}  # search page
searchPattern = {
    "bookLists":"bs:.find(class_='slide-item list1').find_all('div')",    # booklists result must be list
    "bookName":"bs:(class_='title')[0].text",
    "bookAuthor":"bs:(class_='author')[0].a.text",
    "bookUrl":"bs:.a['href']",
    "lastChapter":"bs:(class_='author')[1].a.text",
    "bookCover":"re.sub('/wapbook/(\\d+)(\\d{3}).*','/files/article/image/$1/$1$2/$1$2s.jpg',str(booklist))",
    "whichBook":"books[0]"
}
bookPattern={
    "tocUrl":"bs:('h2')[1].a.get('href')",  # same as the bookUrl
    "bookIntro":"bs:(class_='review')[0].text.strip()"   # book introduction text
}
tocPattern={
    "chapterUrl":"re:<a href=\\\"(/wapbook/\\d+_\\d+.*?)\\\">",
    "chapterName":"re:<a href=\\\"/wapbook/\\d+_\\d+.*?\\\">(.+?)</a>"
}
chapterPattern={
    "name":"bs:(class_='title')[0].text",
    "content":"bs:(id='chaptercontent')[0].contents[8:-6]",
    "filter":"''.join([str(x) for x in content])"
}